package com.zp.utils;

import javax.servlet.http.Cookie;

public class CookieUtil {

    /**
     * 从一个Cookie数组中找到需要的Cookie
     * @param cookies
     * @param name
     * @return
     */
    public static Cookie findCookie(Cookie[] cookies, String name) {
        if (cookies != null) {
            for (Cookie cookie:cookies) {
                if (name.equals(cookie.getName())) {
                    return cookie;
                }
            }
        }
        return null;
    }

}
